﻿using System.Web.Mvc;
using JuCheap.Service.AppService;
using JuCheap.Service.Model;

namespace JuCheap.WebUI.Controllers
{
    public class HomeController : Controller
    {
        private readonly IUserService userService;
        public HomeController(IUserService userSvr)
        {
            userService = userSvr;
        }

        public ActionResult Index()
        {
            var filter = new[]
            {
                //new QueryFilter {Key = "Account", Value = "admi", Contract = LinkType.StartsWith , Condition =  ConditionType.And},
                //new QueryFilter {Key = "TrueName", Value = "adm", Contract = LinkType.Like , Condition =  ConditionType.Or},
                new QueryFilter {Key = "TrueName", Value = "admin", Contract = LinkType.EndsWith , Condition =  ConditionType.And}

            };
            var list = userService.Query(filter);
            return View(list);
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}